package com.atguigu.lease.web.admin.custom.convert;

import com.atguigu.lease.model.enums.ItemType;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;

/**
 * @ClassName ItemTypeConvert
 * @Author heartFade
 * @Date 2025-05-01 16:08
 * @Version 1.0
 * @Description TODO
 **/
//@Configuration
public class ItemTypeConvert implements Converter<String, ItemType> {

    @Override
    public ItemType convert(String source) {
        ItemType[] values = ItemType.values();
        for(ItemType v:values)
        {
            if(source.equals(String.valueOf(v.getCode())))
            {
                return v;
            }
        }
        return null;
    }
}
